#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using EstateNuke.Report.EstateNukeCoreDBDataSetTableAdapters;
using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;
using Microsoft.Reporting.WebForms;

#endregion

namespace EstateNuke.Report
{
    public partial class WeeklySummaryReportControl : UserControl
    {

        private DateTime DateFrom;
        private DateTime DateTo;
        private int ProjectId;

        public WeeklySummaryReportControl(DateTime datetimeFrom, DateTime datetimeTo, int projectId)
        {
            InitializeComponent();
            DateFrom = datetimeFrom;
            DateTo = datetimeTo;
            ProjectId = projectId;
        }

        private void WeeklySummaryReportControl_Load(object sender, EventArgs e)
        {

        }


        private void reportViewer1_HostedPageLoad(object sender, Gizmox.WebGUI.Forms.Hosts.AspPageEventArgs e)
        {

            this.reportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
            reportViewer1.LocalReport.ReportPath = "../EstateNuke.Report/Report/SalesReport.rdlc";
            this.reportViewer1.LocalReport.DataSources.Clear();

            EstateNukeCoreDBDataSet source = new EstateNukeCoreDBDataSet();
            SalesSummaryReportTableAdapter adapterSales = new SalesSummaryReportTableAdapter();
            adapterSales.Fill(source.SalesSummaryReport, DateFrom, DateTo, ProjectId);

            LeaseSummaryReportTableAdapter adapterLease = new LeaseSummaryReportTableAdapter();
            adapterLease.Fill(source.LeaseSummaryReport, DateFrom, DateTo, ProjectId);

            CustomerCommunicationSummaryReportTableAdapter adapterCustomerCommunication = new CustomerCommunicationSummaryReportTableAdapter();
            adapterCustomerCommunication.Fill(source.CustomerCommunicationSummaryReport, DateFrom, DateTo, ProjectId);


            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("SaleDataSet", source.SalesSummaryReport.Copy()));
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("LeaseDataSet", source.LeaseSummaryReport.Copy()));
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("CustomerCommunicationSummaryDataSet", source.CustomerCommunicationSummaryReport.Copy()));

            this.reportViewer1.LocalReport.Refresh();
        }
    }
}